//
//  PKGroupNoneImageCell.m
//  PianKe
//
//  Created by lanou on 15/10/15.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKGroupNoneImageCell.h"

@implementation PKGroupNoneImageCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WITDTH-20, 40)];
        _titleLabel.numberOfLines = 2;
        
        _contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, SCREEN_WITDTH-20, 0)];
        _contentLabel.numberOfLines = 4;
        _contentLabel.font = [UIFont systemFontOfSize:14];
        
        _addtime_fLabel = [[UILabel alloc]initWithFrame:CGRectMake(10,  60, 100, 20)];
        
        _commentBt = [UIButton buttonWithType:UIButtonTypeCustom];
        _commentBt.frame = CGRectMake(SCREEN_WITDTH-100,  60, 20, 15);
        _commentBt.backgroundColor = [UIColor yellowColor];
        
        _commentLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH-75,  60, 60, 20)];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_contentLabel];
        [self.contentView addSubview:_addtime_fLabel];
        [self.contentView addSubview:_commentBt];
        [self.contentView addSubview:_commentLabel];
        
        
        
    }
    return self;
}

-(void)configureNoneImageCell:(PKGroupDetailViewModel *)model
{
    
    CGFloat height = [PKGroupNoneImageCell heightOfNoneImageCell:model.content];
    
    _model = model;
    _titleLabel.text = model.title;
    _contentLabel.text = model.content;
    _contentLabel.frame = CGRectMake(10, 40, SCREEN_WITDTH-20, height);
    
    _addtime_fLabel.text = model.addtime_f;
    _addtime_fLabel.frame = CGRectMake(10, height + 50, 100, 20);
    
    _commentBt.frame = CGRectMake(SCREEN_WITDTH-100, height + 50, 20, 15);
    
    _commentLabel.text = [model.counterList.comment stringValue];
    _commentLabel.frame = CGRectMake(SCREEN_WITDTH-75, height + 50, 60, 20);
    
    
    
    
    
}
+(CGFloat)heightOfNoneImageCell:(NSString *)string
{
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName];
    CGRect bounds = [string boundingRectWithSize:CGSizeMake(SCREEN_WITDTH-20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return bounds.size.height;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
